{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# SVM中使用多项式特征"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn import datasets\n",
    "\n",
    "# 生成数据集\n",
    "X, y = datasets.make_moons()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((100, 2), (100,))"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X.shape, y.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAD8CAYAAACfF6SlAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAHdBJREFUeJzt3X+QHOV95/H3l9UK1o6tBWuDYSVZcrK2gxE2sIXt6OoOWxgLqkBEOBgcx5AzUXwpLrncxWVRpLBLKZdEuDMJZeJERRyDEwOKTeS1LUeOJShXXIFjCT8lLJAVc9oFWxtAuiMs6Aff+2N6YDTbPTuz09P9dPfnVaXa+fFo+umZ5/lOz/N8+2lzd0REpFqOy7sCIiKSPQV/EZEKUvAXEakgBX8RkQpS8BcRqSAFfxGRClLwFxGpIAV/EZEKUvAXEamgeXlXIMnChQt96dKleVdDRKRQHnzwwX9z96HZygUb/JcuXcr4+Hje1RARKRQze7qdchr2ERGpIAV/EZEKUvAXEakgBX8RkQpS8BcRqSAFfxGRCkol+JvZV8xsv5k9n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H/y7M+jPRGb4iIhVUxWEfEZHKU/AXEakgBX8RkQpS8BcRqSAFfxGRClLwFxGpIAV/EZEKUvAXEamg/w9hi7VzZGEXKAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10900b668>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X[y==0,0], X[y==0,1])\n",
    "plt.scatter(X[y==1,0], X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAD8CAYAAABzTgP2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAIABJREFUeJzt3X+wXGWd5/H3hxAgs7pJ+DEISS4/arIoCgbnLjpirfJDQKeGZNTJgDtrrILKWqPrrtZQhnILqTizRq0ZHGudGbOI4tQMmEXFqLgICaxVKgyXISaAgwQYh1yjMEKy45KFEL77R59LTnf6x+nu0+dH9+dV1XW7zzl975OT7vM9z/N8n+dRRGBmZjbnsLILYGZm1eLAYGZmTRwYzMysiQODmZk1cWAwM7MmDgxmZtbEgcHMzJo4MJiZWRMHBjMza3J42QUYxLHHHhsnn3xy2cUwM6uV++67758j4rhex9UyMJx88snMzMyUXQwzs1qR9NMsx7kpyczMmjgwmJlZEwcGMzNr4sBgZmZNcgkMkq6X9KSkBzrs//eStkvaIekHkl6b2vePyfZtktyjbGZWsrxqDF8CLu6y/3HgzRFxBvBxYGPL/nMjYkVETOdUHjMzG1Au6aoR8T1JJ3fZ/4PUy7uBpXn8XTMzy18Z4xguB76Teh3AdyUF8PmIaK1NWE3ccv8sn77tYX62Zx8nLlrAlRedxqqzlpRdLDPrU6GBQdK5N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gCPAHcARyfbp4HrkudvBHbQyK7ZAVxeQjkPOV/AeuCS5PlRwP8EdgJ/B5xa8uegV3k/ATyYnNM7gVeWWNYbgd3A/uSzeznwPuB9yX4Bn0v+LTvokG1XofJ+IHVu7wbeWHJ53wQEsB3YljzeXuVznPXhkc9mZtbETUlmZtbEgcHMzJo4MJiZWRMHBjMza+LAYGZmTRwYzMysiQODmZk1cWAwM7Mm/x/dpIxGsCDuAgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10900b4a8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 为数据制造一些噪音\n",
    "X, y = datasets.make_moons(noise=0.15, random_state=666)\n",
    "\n",
    "plt.scatter(X[y==0,0], X[y==0,1])\n",
    "plt.scatter(X[y==1,0], X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 使用多项式特征的SVM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Pipeline(memory=None,\n     steps=[('poly', PolynomialFeatures(degree=3, include_bias=True, interaction_only=False)), ('std_scaler', StandardScaler(copy=True, with_mean=True, with_std=True)), ('linearSVC', LinearSVC(C=1.0, class_weight=None, dual=True, fit_intercept=True,\n     intercept_scaling=1, loss='squared_hinge', max_iter=1000,\n     multi_class='ovr', penalty='l2', random_state=None, tol=0.0001,\n     verbose=0))])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.preprocessing.data import PolynomialFeatures, StandardScaler\n",
    "from sklearn.svm.classes import LinearSVC\n",
    "from sklearn.pipeline import Pipeline\n",
    "\n",
    "def PolynomialSVC(degree, C=1.0):\n",
    "    return Pipeline([\n",
    "        ('poly', PolynomialFeatures(degree=degree)),\n",
    "        ('std_scaler', StandardScaler()),\n",
    "        ('linearSVC', LinearSVC(C=C))\n",
    "    ])\n",
    "\n",
    "poly_svc = PolynomialSVC(degree=3)\n",
    "\n",
    "# 不进行预测，因此不分训练集、测试集\n",
    "poly_svc.fit(X, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "from playML.plot_utils import plot_decision_boundary, plot_svc_decision_boundary"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 画出决策边界"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/seamonster/MachineLearningClassicAlgorithmEnv/lib/python3.6/site-packages/matplotlib/contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAIABJREFUeJzt3X+QHOWd3/H3V7t70hqvWGSQkSUsGRsUI5NIhuLs01VCcfhiyVfgy+nusKU6mbKjODlALipV5qIrLkUVFdupokpgJ46KMycfLv+Ikvh0sVQcMnacUoJj8cti4SQLyhzaWyxAh7S2V0a7evLH9IjR0D3TM/N099Pdn1fVlmZnercf9c709/nxfZ7HnHOIiIjMK7oAIiISBgUEEREBFBBERCSigCAiIoACgoiIRBQQREQE8BQQzOwrZnbMzJ5OeP1aMzthZk9GX3f6OK+IiPgz7On3/AXwReCrHY7538653/F0PhER8cxLC8E59wPguI/fJSIixfDVQkjjg2b2FPD3wL91zk20H2BmW4AtAOfNn3/VZRdfnGPxRCRvr46+regiVM6Lf/v4K865i/r52bwCwuPAcufcz81sPfBt4LL2g5xzO4AdAGtWrHD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DHOxxyI/BV1/AoMG5mS/Ip3RtSlLNwzrkp59zj0eNpGpmRS9sOK/x6pixnz4IJCD1wwN+Y2WPRUhchiluuY+A/Vo/e7pybih6/BLw94bgFZnbAzB41s7yCRprrc/YY10hdPgG8LZfSxZQhkvR3/L2o62CXmV0S83rRQng/pvVBM3vKzPaa2aoiCxJ1U64Bftj2UlDXs0M5ocfrmcdaRmd5WgbjN51zk2a2GHjYzP42qnl4k+dyHYPoVM7Wb5xzzsyS8ouXR9fzUuARMzvonHvOd1kr7K+BrzvnfmVm/4pGq+a6gstUVo/TeD/+3MzWA98GLiuiIGb2VuC/AZ9xzp0sogxpdClnz9cz14DgBl8GA+fcZPTvMTP7HzSa9V4Dgody5rJcR6dymtnPzGyJc24qas4eS/gdzev5vJl9n0ZNI+uAkOb6NI85ambDwPnAqxmXq13XcjrnWst0P42xm9CUYvmY1huac26Pmf0nM7vQOZfrgnJmNkLjJvs159x/jzkkiOvZrZz9XM9SdRmZ2XlmNtZ8DPw2jT0ZQhPCch27gc3R483Am1o2ZnaBmc2PHl8IrCWfZcnTXJ/W8m8AHnHRSFmOupazre/4Bhp9uaHZDfxRlB3zAeBES3diMMzs4uY4kZldQ+P+lGslIDr/nwPPOufuSTis8OuZppx9Xc+8R8c7jJr/Lo2+uF8BPwMeip5/B7AnenwpjUwKAeTPAAAAwklEQVSPp4AJGl04wZXTvZGJcJhGbbuIcr4N+C7wE2AfsCh6/mrg/ujxbwAHo+t5EPhkjuV70/UB7gJuiB4vAP4rcAT4f8ClBb0vu5XzP0TvxaeA7wH/qIAyfh2YAk5H781PAp8GPh29bjQ2qXou+jsnZvEVXM5bWq7lo8BvFFDG36QxTvlj4Mnoa31o1zNlOXu+nlq6QkREgJJ1GYmISHYUEEREBFBAEBGRiAKCiIgACggiIhJRQBAREUABQUREIv8fw7MAn5ecC0QAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x109160898>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(poly_svc, axis=[-1.5, 2.5, -1.0, 1.5])\n",
    "plt.scatter(X[y==0,0], X[y==0,1])\n",
    "plt.scatter(X[y==1,0], X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 使用多项式核函数的SVM\n",
    "\n",
    "原理下一节再讲，现在先使用，有一个感性认识"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.svm.classes import SVC\n",
    "\n",
    "def PolynomialKernelSVC(degree, C=1.0):\n",
    "    return Pipeline([\n",
    "        ('std_scaler', StandardScaler()),\n",
    "        ('kernelSVC', SVC(kernel='poly', degree=degree, C=C))\n",
    "    ])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Pipeline(memory=None,\n     steps=[('std_scaler', StandardScaler(copy=True, with_mean=True, with_std=True)), ('kernelSVC', SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,\n  decision_function_shape='ovr', degree=3, gamma='auto', kernel='poly',\n  max_iter=-1, probability=False, random_state=None, shrinking=True,\n  tol=0.001, verbose=False))])"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "poly_kernel_svc = PolynomialKernelSVC(degree=3)\n",
    "poly_kernel_svc.fit(X, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/seamonster/MachineLearningClassicAlgorithmEnv/lib/python3.6/site-packages/matplotlib/contour.py:967: UserWarning: The following kwargs were not used by contour: 'linewidth'\n  s)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwS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FVa65TfB55M/myO7f1M2c7M76dKV4iICFCxKSMREcmPAoKIiAAKCCIiklBAEBERQAFBREQSCggiIgIoIIiISOL/A3JQ3GR4I9RoAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10cd55b00>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(poly_kernel_svc, axis=[-1.5, 2.5, -1.0, 1.5])\n",
    "plt.scatter(X[y==0,0], X[y==0,1])\n",
    "plt.scatter(X[y==1,0], X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
